#! /bin/bash

# js dir
WORK_DIR="../output/web/doc/script"

# yuicompressor path
YUI_TOOL="../../../lib/yuicompressor-2.4.8.jar"

#==== js file list
js_file_list="
checkform.js
common.js
download.js
inc.js
jwplayer_ref.js
login.js
log.js
main.js
paramconfig.js
playback.js
playsplitwnd.js
preview.js
timebar.js
Translator.js
"

js_file_list+="
params/485config.js
params/abnormal.js
params/alarmin.js
params/alarmout.js
params/blockalarm.js
params/CapturePlan.js
params/configlocal.js
params/device.js
params/devicemaintenance.js
params/displaychan.js
params/harddisk.js
params/holiday.js
params/ipc.js
params/movedetect.js
params/networkbasic.js
params/overlays.js
params/platform.js
params/recordplan.js
params/user.js
params/videocover.js
params/videoeffectconfig.js
params/videolost.js
params/videoset.js
params/ZeroChannel.js
"

function compress_files() {
for file in ${js_file_list}
do
	echo "compressing file "$WORK_DIR/"$file"
	yuicommand="java -jar "$YUI_TOOL" "$WORK_DIR"/"$file" -o "$WORK_DIR"/"$file" --charset=utf-8"
	`$yuicommand`
done
}

compress_files

